<?php

namespace App\Consts;

/**
 * 全局登录常量定义
 * @author dumpling
 */
class GlobalLoginConst
{
    public const LOGIN_STATE_INFO_USER = 'user';
    public const LOGIN_STATE_INFO_TOKEN = 'token';

    // token加密算法
    public const TOKEN_ENCRYPT_METHOD = 'AES-128-CBC';

    // access_token过期时间
    public const ACCESS_TOKEN_EXPIRED = 7 * 86400;

    // refresh_token过期时间
    public const REFRESH_TOKEN_EXPIRED = 30 * 86400;

    // 登陆方式：1手机号验证码，2手机号密码，3QQ，4微信，5微博
    public const LOGIN_METHOD_TEL = 1;
    public const LOGIN_METHOD_TEL_PASSWORD = 2;
    public const LOGIN_METHOD_TENCENT = 3;
    public const LOGIN_METHOD_WECHAT = 4;
    public const LOGIN_METHOD_SINA = 5;

    // 登录端：1Web端，2小程序，3iOS，4安卓
    public const LOGIN_PLATFORM_WEB_STR = 'pc';
    public const LOGIN_PLATFORM_WEB = 1;
    public const LOGIN_PLATFORM_APPLET = 2;
    public const LOGIN_PLATFORM_IOS = 3;
    public const LOGIN_PLATFORM_ANDROID = 4;

    public static $tokenEncrypt = [
        self::LOGIN_PLATFORM_WEB => [
            'tokenSecret' => '3iGj!WiU', // token加密secret
            'tokenIv' => 'V5y&jH&P6tY#3jnE', // token加密iv
            'signSecret' => 'i^!$K*ttZS@eL1jaYq^xs*z4pVv1bwoz', // 参数加密secret
        ]
    ];
}
